Byte2IO
 
 
 Bean Byte2IO
 
General Two-Bytes Input/Output

Typical usage of the bean in user's code.

Typical Usage:

Required bean name is "Bt21".
Examples of a typical usage of this bean follow:

(1)
The direction of the bean is set to input.

 MAIN.C

void main(void)
{
  /* Wait until "10101010" is on the low port
     and "01010101" is on the high port */
  while( Bt21_GetVal() != 0x55AA );
    :
}

(2)
The direction of the bean is set to output.

 MAIN.C

void main(void)
{
  Bt21_PutVal(0x55AA);
  /* "10101010" is on the low port and
     "01010101" is on the high port */
  
  for (;;) {
  /* Invert output level of first pin on the high port */
    Bt21_NegBit(8);
  }
}

(3)
The direction of the bean is set to input/output.

 MAIN.C

void main(void)
{
  Bt21_SetDir(FALSE);  // Set input mode

  /* Wait until "0xFFFF" is on the ports */
  while( Bt21_GetVal() != 0xFFFF );
  
  Bt21_SetDir(TRUE);   // Set output mode

  Bt21_PutVal(0);      // Set "0x0000" on the ports
}

For more about typical usage of the bean code please refer to the page Bean Code Typical Usage.


Processor ExpertTM and Embedded BeansTM are registered trademarks of UNIS, Ltd.
©1997-2005, UNIS, Ltd.